import React from 'react'
import './style/app.scss'
class App extends React.Component {
    constructor() {
        super()
        this.state = {
            num: 0
        }
    }
    setNum(index) {
        this.setState({
            num: index
        })
        console.log(this.state.num)
    }
    render() {
        const { num } = this.state
        return <>
            <div>
                <span className={num === 0 ? 'active' : ''} onClick={() => this.setNum(0)}>模块一</span>
                <span className={num === 1 ? 'active' : ''} onClick={() => this.setNum(1)}>模块二</span>
                <span className={num === 2 ? 'active' : ''} onClick={() => this.setNum(2)}>模块三</span>
            </div>
            <div className='boxs'>
                <div></div>
                <div></div>
                <div></div>
            </div>
        </>
    }
}
export default App

